﻿using HungryCrowdLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HungryCrowd.HelperFunctions;
using System.Web.Script.Serialization;

namespace HungryCrowd.markets
{
    public partial class update : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ddlLocations.PopulateDropDownLists(typeof(Location));
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var market = new Market();
            market.Name = txtName.Text;
            market.LocationId = int.Parse(hdLocationId.Value);
            market.IsActive = true;
            hdLocation.Value = new JavaScriptSerializer().Serialize(market);
        }
    }
}